//<feature charts>
Ext.define('AkData.view.AgirlikVerilmesi', {
    extend: 'Ext.Panel',
    requires: ['Ext.chart.Chart', 'Ext.chart.interactions.PanZoom', 'Ext.chart.series.Bar', 'Ext.chart.axis.Numeric', 'Ext.chart.axis.Category', 'Ext.carousel.Carousel'],
    config: {
        //cls: 'card1',
		//layout: 'fit',
		//fullscreen: true,

		layout: 'vbox',
		
        items: [
            {
                xtype: 'toolbar',
                //cls: 'charttoolbar',
                top: 0,
                right: 0,
                zIndex: 50,
                style: {
                    background: 'none'
                },
				items: [
                    {
                        iconCls: 'refresh',
						style: {'background': '#E8E8E8', 'color': 'black'},
                        handler: function () {
							Ext.Viewport.mask({xtype: 'loadmask', message: _lang_Yukleniyor});
							Ext.getStore('AgirlikVerilmesi_Store').load(function(records, operation, success) {Ext.Viewport.unmask();}, this);
                        }
                    },
				]
            },
			{
				flex: 1,
                xtype: 'chart',
                store: 'AgirlikVerilmesi_Store',
                background: 'white',
				id: 'AgirlikVerilmesi_ID',
				maxWidth: '90%',
                colors: AkData.view.ColorPatterns.getAlteredBaseColorsHSL({s: -0.1}),
				//legend: {position: 'bottom',},
				flipXY: true,
                series: [
                    {
                        type: 'bar',
                        xField: 'baslik',
                        yField: ['deger'],
						//title: ['Değer'],
                        stacked: false,
						style: {maxBarWidth: 20},
						label: {display: 'outside', field: ['deger']},
                    }
                ],
				
                axes: [
                    {
                        type: 'numeric',
                        fields: 'deger',
						grid: true,
						//title: {text: 'Haftalık Üretimler', fontSize: 15}
						//label: {rotate: {degrees: -315}, fontSize: 9, /*x: 85, textAlign: 'end',*/ /*textBaseline: 'middle'*/},
                    },
                    {
						//labelInSpan: true,
                        type: 'category',
                        position: 'left',
                        fields: 'baslik',
						label: {/*rotate: {degrees: -30},*/ /*,textAlign: 'right', */'text-anchor': 'right', /*textBaseline: 'middle'*/},
						grid: true,
						//visibleRange: [0, 2],
						//title: {text: 'Haftalar', fontSize: 15}
                    }
                ]
            },
        ]
    },
	
    initialize: function () {
		this.callParent();
		
		var task = Ext.create('Ext.util.DelayedTask', function() {
			Ext.Viewport.mask({xtype: 'loadmask', message: _lang_Yukleniyor});
			Ext.getStore('AgirlikVerilmesi_Store').load(function(records, operation, success) {Ext.Viewport.unmask();}, this);
		}, this);

		task.delay(500);
    }
	
});
//</feature>
